package com.cy2;

import java.util.HashMap;
import java.util.Map;

public class HashMapDemo2 {
    public static void main(String[] args) {
        HashMap<Student, String> hp = new HashMap<>();
        Student s1 = new Student("林青霞", 30);
        Student s2 = new Student("张曼玉", 50);
        Student s3 = new Student("王祖贤", 18);
        hp.put(s1,"200123");
        hp.put(s2,"79513");
        hp.put(s3,"79513");
        for (Map.Entry<Student, String> studentStringEntry : hp.entrySet()) {
            System.out.println(studentStringEntry.getKey().getName()+","+ studentStringEntry.getKey().getAge()+","+ studentStringEntry.getValue());
        }

    }
}
